$(function() {
	//<---------------商家和和店家的鼠标点击事件----------------->
	$("#search_option > div").click(function() {
			$("#search_option > div").removeClass("select_option");
			$("#search_option > div").addClass("unselect_option");
			$(this).addClass("select_option");
			$(this).removeClass("unselect_option");
			//<---------------处理下面的热搜关键词----------------->
			$("#he_search_hot > ul").css("display", "none");
			$("#he_search_hot > ul").eq($(this).index()).css("display", "block");
		})
	//点击logo进入首界面
	$("#header_yh_logo img").click(function () {
		window.location = "index.html";
	})
		//<---------------行业分类的鼠标移入和移出事件----------------->
	$("#first_item").mouseenter(function() {
		$("#he_list_bottom").css("display", "block");
		$("#he_list_left").slideDown(300);
		$('#he_dire_logo').addClass("down_to_top");
		$('#he_dire_logo').removeClass("top_to_down");
	})
	$("#first_item").mouseleave(function() {
			$("#he_list_bottom").css("display", "none");
			$("#he_list_left").slideUp(300);
			$('#he_dire_logo').addClass("down_to_top");
			$('#he_dire_logo').addClass("top_to_down");
			//<------------------使详情部分的内容消失---------------------->
			$(".he_list_details").hide(0);
			$("#he_list_left > li").css("backgroundColor", "black");
		})
		//<------------------列表中li的鼠标移入和移出事件---------------------->
	$("#he_list_left > li").mouseenter(function() {
		//<------------------使详情部分的内容显示---------------------->
		$(".he_list_details").show(0);
		$("#he_list_left > li").css("backgroundColor", "rgb(0,0,0)");
		$(this).css("backgroundColor", "rgb(220,84,0)");
		$(".he_list_details").css("display", "none");
		$(".he_list_details").eq($(this).index()).css("display", "block");
	});
	//<------------------设置鼠标移入详情的中的a标签---------------------->
	$(".he_list_details a").mouseenter(function() {
			$(".he_list_details a").css({
				color: 'white',
				textDecoration: 'none'
			})
			$(this).css({
				color: '#ec6a17',
				textDecoration: 'underline'
			})
		})
		//<------------------设置nav的鼠标移入事件---------------------->
	$("#he_bottom_nav > li").click(function() {
			if ($(this).index() != 0) {
				$("#he_bottom_nav > li > a").css("color", "#323333");
				$(this).find("a").css("color", "rgb(242,86,11)");
			}
		})
		//<----------------取出登录的值------------------>
	if (sessionStorage.getItem("user_phone")) {
		$("#he_tel").text(sessionStorage.user_phone);
	}
	if (getCookie("user_phone")) {
		$("#he_tel").text(getCookie("user_phone"));
	}
	//<-------------我的易和的点击事件-------------->
	$("#he_my_yh").click(function() {
			if ($("#he_tel").text() == "请登录") {
				alert("请您先登录");
			} else {
				window.location = "my_account.html";
			}
		})
		//<-------------购物车点击事件-------------->
	$("#he_shop_car").click(function() {
			if ($("#he_tel").text() == "请登录") {
				alert("请您先登录");
			} else {
				window.location = "MyShooping.html";
			}
		})
		//获取app
	var app = angular.module("myApp", []);
	app.controller("myController", function($scope, $http) {
			$scope.wdBaidu = "";
			$scope.changeFn = function() {
				$http.jsonp("https://sp0.baidu.com/5a1Fazu8AA54nxGko9WTAnF6hhy/su?wd=" + $scope.wdBaidu + "&cb=JSON_CALLBACK").success(function(res) {
					console.log(res);
					$scope.content = res;
					$scope.mouse = true;
				});
			}
			$scope.mouse = true;
			$scope.getData = function() {
				$scope.wdBaidu = this.item;
				$scope.mouse = false;
			}
		})
		//	联系别人
	$(".who_line").click(function() {
		$(".who_online").css("display", "block");
	})
	$(".who_online").css("display","none");
	$(".who_online img").click(function () {
		if ($(this).index() == 0) {
			alert("联系QQ客服1")
		} else if ($(this).index() == 1) {
			alert("联系QQ客服2")
		} else if ($(this).index() == 2) {
			alert("联系QQ客服3")
		} 
	})
	$("#he_online_server").mouseleave(function() {
		$(".who_online").css("display", "none");
	})
	$("#search_btn").click(function(){
		var c=$("#search_text").val();
		console.log(typeof(c));
//		if(c.split("之")[0]=="海澜"){
//			window.location="M_search.html";
//		}
		if(c=="海澜之家官方旗舰店"){
			window.location="M_search.html";
		}
		if(c=="海澜之家男士短衬衫"){
			window.location="M-goodsPage.html";
		}
		if(c=="海澜之家商品搜索"){
			window.location="M_search_goods.html";
		}
	})
	//-------------------选择城市页面----添加点击事件-----------------------
	$(".hcity").click(function () {
		window.location = "switch_city.html"
	})
	//	 首页的城市
	if(localStorage.getItem("nowCity")==""||localStorage.getItem("nowCity")==null){
		$(".hcity").text("");
	}else{
		console.log(localStorage.getItem("nowCity"));
		$(".hcity").text(localStorage.getItem("nowCity"));
	}
})

